﻿using System;
using System.Text.RegularExpressions;

public class StringExpression
{
    public string[] args = new string[0];
    public string name = string.Empty;

    public StringExpression(string text)
    {
        Match match = Regex.Match(text, @"\[(.*?)\]");
        if (match.Success)
        {
            string input = match.Groups[1].Value;
            this.name = input;
            if (this.name.Contains("("))
            {
                char[] separator = new char[] { '(' };
                this.name = this.name.Split(separator)[0];
            }
            this.name = this.name.Trim();
            Match match2 = Regex.Match(input, @"\((.*?)\)");
            if (match2.Success)
            {
                string str2 = match2.Groups[1].Value;
                char[] chArray2 = new char[] { ',' };
                this.args = str2.Split(chArray2);
                for (int i = 0; i < this.args.Length; i++)
                {
                    this.args[i] = this.args[i].Trim();
                }
            }
        }
    }

    public bool IsName(string name)
    {
        return this.name.ToLower().Equals(name.ToLower());
    }
}

